﻿<%@ Page Title="" Language="C#" MasterPageFile="~/ascom/MasterPageSite2.master" %>
<%@ Import Namespace = "System.Data.SqlClient" %>

<script runat="server">
    string mensagem, mensagemLink = null;
    string url = null;

    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection conexao_intranet = null;
        conexao_intranet = new SqlConnection(ConfigurationManager.ConnectionStrings["conexao_intranet"].ConnectionString);
        SqlDataReader dr1 = null;

        try
        {
            if (conexao_intranet != null && conexao_intranet.State != System.Data.ConnectionState.Open)
            {
                conexao_intranet.Open();
                SqlCommand seleciona_mensagem = new SqlCommand("select * from mensagens_sistema where id_mensagem =" + Request.QueryString["id_mensagem"], conexao_intranet);
                dr1 = seleciona_mensagem.ExecuteReader();
                dr1.Read();
                mensagem = dr1["mensagem"].ToString();
                mensagemLink = dr1["mensagemlink"].ToString();
                url = dr1["url"].ToString();
                dr1.Close();
            }

        }
        catch (Exception erro)
        {
            Response.Write(erro.Message);
        }
        finally
        {
            if (dr1 != null)
            {
                dr1.Close();
            }
            if (conexao_intranet != null)
            {
                conexao_intranet.Close();
            }
        }
    }
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div>
        <table align="center" style="width: 495px">
            <tr>
                <td>
                    <div align="center">
                        <strong><%=mensagem%></strong>
                    </div>
                </td>
            </tr>
                              <% if (url != "")
                                 { %>
                              <tr>
                                  <td>
                                      <div align="center">
                                          <a href="<%=url%>" target="_parent"><%=mensagemLink%></a>
                                      </div>
                                  </td>
            </tr>
                              <%} %>
                              <tr>
                                  
            </tr>
        </table>    
    </div>
</asp:Content>

